<!DOCTYPE html>
<html>
<head><meta name="generator" content="Hexo 3.9.0">
  <meta charset="utf-8">
  
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <title>git入门级--在github创建项目 | leenty blog</title>
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
  <meta name="description" content="git分布式版本控制系统我第一个接触的版本控制系统是svn，当时觉得版本控制就是这样，直到我遇到了git…git是分布式版本控制系统，合适分布式开发，强调个体。速度快、灵活，代码冲突了也比较好解决，最让我喜欢的还是git的分支切换。 在github上创建一个空项目我这里git的远程仓库选择github，github是全球最大的代码托管库，在国内也有许多类似的站点可以选用（比如：coding）。">
<meta name="keywords" content="git,github">
<meta property="og:type" content="article">
<meta property="og:title" content="git入门级--在github创建项目">
<meta property="og:url" content="http://baidu.com/2016/06/02/git入门级-在github创建项目/index.html">
<meta property="og:site_name" content="leenty blog">
<meta property="og:description" content="git分布式版本控制系统我第一个接触的版本控制系统是svn，当时觉得版本控制就是这样，直到我遇到了git…git是分布式版本控制系统，合适分布式开发，强调个体。速度快、灵活，代码冲突了也比较好解决，最让我喜欢的还是git的分支切换。 在github上创建一个空项目我这里git的远程仓库选择github，github是全球最大的代码托管库，在国内也有许多类似的站点可以选用（比如：coding）。">
<meta property="og:locale" content="zh-CN">
<meta property="og:image" content="http://baidu.com/img/git-1/2016-06-02_201840.png">
<meta property="og:image" content="http://baidu.com/img/git-1/2016-06-02_202425.png">
<meta property="og:image" content="http://baidu.com/img/git-1/2016-06-02_203556.png">
<meta property="og:image" content="http://baidu.com/img/git-1/2016-06-02_204015.png">
<meta property="og:image" content="http://baidu.com/img/git-1/2016-06-02_204340.png">
<meta property="og:image" content="http://baidu.com/img/git-1/2005796-ec0fa26bc9843e66.png">
<meta property="og:image" content="http://baidu.com/img/git-1/2016-06-02_205620.png">
<meta property="og:image" content="http://baidu.com/img/git-1/2016-06-02_210116.png">
<meta property="og:image" content="http://baidu.com/img/git-1/2016-06-02_210744.png">
<meta property="og:image" content="http://baidu.com/img/git-1/2016-06-02_211044.png">
<meta property="og:image" content="http://baidu.com/img/git-1/2016-06-02_211323.png">
<meta property="og:image" content="http://baidu.com/img/git-1/2016-06-02_211555.png">
<meta property="og:image" content="http://baidu.com/img/git-1/2016-06-02_211758.png">
<meta property="og:image" content="http://baidu.com/img/git-1/2016-06-02_211908.png">
<meta property="og:updated_time" content="2016-11-06T15:21:47.000Z">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="git入门级--在github创建项目">
<meta name="twitter:description" content="git分布式版本控制系统我第一个接触的版本控制系统是svn，当时觉得版本控制就是这样，直到我遇到了git…git是分布式版本控制系统，合适分布式开发，强调个体。速度快、灵活，代码冲突了也比较好解决，最让我喜欢的还是git的分支切换。 在github上创建一个空项目我这里git的远程仓库选择github，github是全球最大的代码托管库，在国内也有许多类似的站点可以选用（比如：coding）。">
<meta name="twitter:image" content="http://baidu.com/img/git-1/2016-06-02_201840.png">
  
    <link rel="alternative" href="/atom.xml" title="leenty blog" type="application/atom+xml">
  
  
    <link rel="icon" href="//favicon.png">
  
  <script src="/style.js"></script>
  

  
<!-- baidu_tongji -->
<script>
var _hmt = _hmt || [];
(function() {
  var hm = document.createElement("script");
  hm.src = "https://hm.baidu.com/hm.js?5bae4c35e53fde3bf2526312c3edaf1d";
  var s = document.getElementsByTagName("script")[0]; 
  s.parentNode.insertBefore(hm, s);
})();
</script>
<!-- End baidu_tongji -->


</head>
</html>
<body>
  <div id="container">
    <div class="left-col">
      <div class="overlay"></div>
<div class="intrude-less">
	<header id="header" class="inner">
		<a href="/" class="profilepic">
			
			<img src="/img/default_avatar.png" class="js-avatar">
			
		</a>

		<hgroup>
		  <h1 class="header-author"><a href="/">leenty</a></h1>
		</hgroup>

		

		<nav class="header-menu">
			<ul>
			
				<li><a href="/">主页</a></li>
	        
				<li><a href="/archives">所有文章</a></li>
	        
			</ul>
		</nav>
		<nav class="header-smart-menu">
	        
    		
    			
    			<a class="js-smart-menu" data-idx="0" href="javascript:void(0)">所有文章</a>
    			
    			
            
    			
    			<a class="js-smart-menu" data-idx="1" href="javascript:void(0)">标签</a>
    			
    			
            
    			
    			<a class="js-smart-menu" data-idx="2" href="javascript:void(0)">友链</a>
    			
    			
            
    			
    			<a class="js-smart-menu" data-idx="3" href="javascript:void(0)">关于我</a>
    			
    			
            
		</nav>
		<nav class="header-nav">
			<div class="social">
				
					<a class="github" target="_blank" href="https://github.com/leenty" title="github">github</a>
		        
			</div>
		</nav>
	</header>		
</div>

    </div>
    <div class="mid-col">
      <nav id="mobile-nav">
  	<div class="overlay">
  		<div class="slider-trigger"><i class="icon-list"></i></div>
  		<h1 class="header-author js-mobile-header hide">leenty</h1>
  	</div>
	<div class="intrude-less">
		<header id="header" class="inner">
			<div class="profilepic">
				
					<img src="/img/default_avatar.png" class="js-avatar">
				
			</div>
			<hgroup>
			  <h1 class="header-author">leenty</h1>
			</hgroup>
			
			<nav class="header-menu">
				<ul>
				
					<li><a href="/">主页</a></li>
		        
					<li><a href="/archives">所有文章</a></li>
		        
				</ul>
			</nav>
			<nav class="header-nav">
				<div class="social">
					
						<a class="github" target="_blank" href="https://github.com/leenty" title="github">github</a>
			        
				</div>
			</nav>
		</header>				
	</div>
</nav>

      <div class="body-wrap">
        <article id="post-git入门级-在github创建项目" class="article article-type-post" itemscope itemprop="blogPost">
  <div class="article-inner">
    
      <input type="hidden" class="isFancy" />
    
    
      <header class="article-header">
        
  
    <h1 class="article-title" itemprop="name">
      git入门级--在github创建项目
    </h1>
  

      </header>
    
    <div class="article-entry" itemprop="articleBody">
      
        <h2 id="git分布式版本控制系统"><a href="#git分布式版本控制系统" class="headerlink" title="git分布式版本控制系统"></a>git分布式版本控制系统</h2><p>我第一个接触的版本控制系统是svn，当时觉得版本控制就是这样，直到我遇到了git…<br>git是分布式版本控制系统，合适分布式开发，强调个体。速度快、灵活，代码冲突了也比较好解决，最让我喜欢的还是git的分支切换。</p>
<h2 id="在github上创建一个空项目"><a href="#在github上创建一个空项目" class="headerlink" title="在github上创建一个空项目"></a>在github上创建一个空项目</h2><p>我这里git的远程仓库选择<a href="https://github.com/" target="_blank" rel="noopener">github</a>，github是全球最大的代码托管库，在国内也有许多类似的站点可以选用（比如：<a href="https://coding.net" target="_blank" rel="noopener">coding</a>）。</p>
<ul>
<li><p>这里假定已经有了github账号。登录github点击右上角的加号，选择new repository选项新建一个项目。<br><img src="/img/git-1/2016-06-02_201840.png" alt="新建项目"></p>
</li>
<li><p>填写新项目的基本信息：<br>新的项目名称，描述，其他默认，然后点击create repository按钮新建项目<br><img src="/img/git-1/2016-06-02_202425.png" alt="填写新项目基本信息"></p>
</li>
<li><p>克隆新项目至本地<br>点击README按钮，去编辑README文件。<br><img src="/img/git-1/2016-06-02_203556.png" alt="新建README文件"><br>写下hello world，然后到页面最下方点击commit new file按钮。<br><img src="/img/git-1/2016-06-02_204015.png" alt="hello world"><br>点击use https 然后点复制按钮<br><img src="/img/git-1/2016-06-02_204340.png" alt="复制"><br>去你的本地文件夹，打开git bash。输入命令</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">git <span class="built_in">clone</span> &lt;刚才复制的项目地址&gt;</span><br></pre></td></tr></table></figure>
</li>
</ul>
<p><img src="/img/git-1/2005796-ec0fa26bc9843e66.png" alt="git bash"><br>如果还没安装git，可以自行百度<a href="https://www.baidu.com/link?url=3rT5SSGCqN8J3w0rw8T7fHKvTEZ6NiYfDK5sxYGK5GCTeEp3A0ufmhe8YVi0-zGiMpcEIk2ibq0s1J-z_Ys8x5VLcpDCwbgvNEE7RBVBj6O&amp;wd=&amp;eqid=a85caa0700009e1500000004575021d8" target="_blank" rel="noopener">下载git</a>，安装无脑，一路下一步就好。<br>到此为止，新的项目就好了。<br><img src="/img/git-1/2016-06-02_205620.png" alt="Paste_Image.png"></p>
<h2 id="提交-commit"><a href="#提交-commit" class="headerlink" title="提交 (commit)"></a>提交 (commit)</h2><p>进入新建的项目文件夹，就可以开始你的代码了。<br><img src="/img/git-1/2016-06-02_210116.png" alt="demo文件夹"><br>这里为了方便，假定已经在项目里写了一段代码。准备提交至远端代码仓库。进入项目文件夹，输入命令：<br><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">git status</span><br></pre></td></tr></table></figure></p>
<p><img src="/img/git-1/2016-06-02_210744.png" alt="git status"><br>添加更改的代码<br><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">git add .</span><br></pre></td></tr></table></figure></p>
<p><img src="/img/git-1/2016-06-02_211044.png" alt="git add ."><br>提交代码<br><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">git commit -m <span class="string">"提交代码"</span></span><br></pre></td></tr></table></figure></p>
<p><img src="/img/git-1/2016-06-02_211323.png" alt="提交代码"><br>log命令可以查看提交历史<br><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">git <span class="built_in">log</span></span><br></pre></td></tr></table></figure></p>
<p><img src="/img/git-1/2016-06-02_211555.png" alt="Paste_Image.png"></p>
<h2 id="推送提交至远程分支push"><a href="#推送提交至远程分支push" class="headerlink" title="推送提交至远程分支push"></a>推送提交至远程分支push</h2><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">git push origin master</span><br></pre></td></tr></table></figure>
<p><img src="/img/git-1/2016-06-02_211758.png" alt="push"><br>至此就完成了git的首次提交<br><img src="/img/git-1/2016-06-02_211908.png" alt></p>
<h2 id="补充"><a href="#补充" class="headerlink" title="补充"></a>补充</h2><p>这里使用的bash是<a href="https://www.baidu.com/link?url=3rT5SSGCqN8J3w0rw8T7fHKvTEZ6NiYfDK5sxYGK5GCTeEp3A0ufmhe8YVi0-zGiMpcEIk2ibq0s1J-z_Ys8x5VLcpDCwbgvNEE7RBVBj6O&amp;wd=&amp;eqid=a85caa0700009e1500000004575021d8" target="_blank" rel="noopener">git(戳这里下载)</a>自带的，如果觉得打命令搞不懂，可以试试图形化界面(例如：sourcetree)</p>

      
    </div>
    <div class="article-info article-info-index">
      
      <a href="/2016/06/02/git入门级-在github创建项目/" class="archive-article-date">
  	<time datetime="2016-06-02T13:42:13.000Z" itemprop="datePublished"><i class="icon-clock"></i>2016-06-02</time>
</a>
      
	<div class="article-tag tagcloud">
		<i class="icon-price-tags"></i>
		<ul class="article-tag-list"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/git/">git</a></li><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/github/">github</a></li></ul>
	</div>

      

      <div class="clearfix"></div>
    </div>
  </div>
</article>

  
<nav id="article-nav">
  
    <a href="/2016/08/30/hello-world/" id="article-nav-newer" class="article-nav-link-wrap">
      <i class="icon-circle-left"></i>
      <div class="article-nav-title">
        
          Hello World
        
      </div>
    </a>
  
  
    <a href="/2016/05/14/gulp实现hexoMarkDown同步编译/" id="article-nav-older" class="article-nav-link-wrap">
      <div class="article-nav-title">gulp实现hexoMarkDown同步编译</div>
      <i class="icon-circle-right"></i>
    </a>
  
</nav>




<div class="share_jia">
	<!-- JiaThis Button BEGIN -->
	<div class="jiathis_style">
		<span class="jiathis_txt">Share to: &nbsp; </span>
		<a class="jiathis_button_facebook"></a> 
	    <a class="jiathis_button_twitter"></a>
	    <a class="jiathis_button_plus"></a> 
	    <a class="jiathis_button_tsina"></a>
		<a class="jiathis_button_cqq"></a>
		<a class="jiathis_button_douban"></a>
		<a class="jiathis_button_weixin"></a>
		<a class="jiathis_button_tumblr"></a>
    <a href="http://www.jiathis.com/share" class="jiathis jiathis_txt jtico jtico_jiathis" target="_blank"></a>
	</div>
	<script type="text/javascript" src="//v3.jiathis.com/code/jia.js?uid=1405949716054953" charset="utf-8"></script>
	<!-- JiaThis Button END -->
</div>






<div class="duoshuo">
	<!-- 多说评论框 start -->
	<div class="ds-thread" data-thread-key="git入门级-在github创建项目" data-title="git入门级--在github创建项目" data-url="http://baidu.com/2016/06/02/git入门级-在github创建项目/"></div>
	<!-- 多说评论框 end -->
	<!-- 多说公共JS代码 start (一个网页只需插入一次) -->
	<script type="text/javascript">
	var duoshuoQuery = {short_name:"leenty-blog"};
	(function() {
		var ds = document.createElement('script');
		ds.type = 'text/javascript';ds.async = true;
		ds.src = (document.location.protocol == 'https:' ? 'https:' : 'http:') + '//static.duoshuo.com/embed.js';
		ds.charset = 'UTF-8';
		(document.getElementsByTagName('head')[0] 
		 || document.getElementsByTagName('body')[0]).appendChild(ds);
	})();
	</script>
	<!-- 多说公共JS代码 end -->
</div>





      </div>
      <footer id="footer">
  <div class="outer">
    <div id="footer-info">
    	<div class="footer-left">
    		&copy; 2019 leenty
    	</div>
      	<div class="footer-right">
      		<a href="http://hexo.io/" target="_blank">Hexo</a>  Theme <a href="https://github.com/litten/hexo-theme-yilia" target="_blank">Yilia</a> by Litten
      	</div>
    </div>
  </div>
</footer>
    </div>
    <script>
	var yiliaConfig = {
		fancybox: true,
		mathjax: false,
		animate: true,
		isHome: false,
		isPost: true,
		isArchive: false,
		isTag: false,
		isCategory: false,
		open_in_new: false,
		root: "/",
		innerArchive: true
	}
</script>

<script src="/./main.js"></script>


    
<div class="tools-col">
  <ul class="btn-wrap">
    
      <li class="chose" data-hook="tools-section-all"><span class="text">全部</span><i class="icon-book"></i></li>
    
    
      <li data-hook="tools-section-tag"><span class="text">标签</span><i class="icon-price-tags"></i></li>
    
    
      <li data-hook="tools-section-friends"><span class="text">友链</span><i class="icon-link"></i></li>
    
    
      <li data-hook="tools-section-me"><span class="text">我</span><i class="icon-smile"></i></li>
    
  </ul>
  <div class="tools-wrap">
    
    	<section class="tools-section tools-section-all chose">
    	</section>
    

    
    	<section class="tools-section tools-section-tag">
    			<div class="widget tagcloud" id="js-tagcloud">
    				<a href="/tags/ES6/" style="font-size: 10px;">ES6</a> <a href="/tags/css/" style="font-size: 15px;">css</a> <a href="/tags/git/" style="font-size: 10px;">git</a> <a href="/tags/github/" style="font-size: 10px;">github</a> <a href="/tags/gulp/" style="font-size: 10px;">gulp</a> <a href="/tags/hexo/" style="font-size: 12.5px;">hexo</a> <a href="/tags/js/" style="font-size: 12.5px;">js</a> <a href="/tags/other/" style="font-size: 10px;">other</a> <a href="/tags/sublime/" style="font-size: 10px;">sublime</a> <a href="/tags/vim/" style="font-size: 10px;">vim</a> <a href="/tags/vue-router/" style="font-size: 17.5px;">vue-router</a> <a href="/tags/vuejs/" style="font-size: 20px;">vuejs</a> <a href="/tags/vuex/" style="font-size: 12.5px;">vuex</a>
    			</div>
    	</section>
    

    
    	<section class="tools-section tools-section-friends">
  		
  			<div class="friends-wrap" id="js-friends">
  			
  	          <a target="_blank" class="main-nav-link switch-friends-link" href="http://vue2.leenty.com">vue2.0演示地址</a>
  	        
  	          <a target="_blank" class="main-nav-link switch-friends-link" href="http://www.leenty.com/">leenty的博客</a>
  	        
  	          <a target="_blank" class="main-nav-link switch-friends-link" href="https://whqet.github.io/">whqet的博客</a>
  	        
  	          <a target="_blank" class="main-nav-link switch-friends-link" href="https://shenyubin.github.io/">沈雨彬的博客</a>
  	        
  	          <a target="_blank" class="main-nav-link switch-friends-link" href="http://www.deboy.cn">Deboy的博客</a>
  	        
  	        </div>
  		
    	</section>
    

    
    	<section class="tools-section tools-section-me">
  	  	
  	  		<div class="aboutme-wrap" id="js-aboutme">不会捣(xia)鼓(gao)的前端不是好全栈</div>
  	  	
    	</section>
    
  </div>
  
</div>
    <!-- Root element of PhotoSwipe. Must have class pswp. -->
<div class="pswp" tabindex="-1" role="dialog" aria-hidden="true">

    <!-- Background of PhotoSwipe. 
         It's a separate element as animating opacity is faster than rgba(). -->
    <div class="pswp__bg"></div>

    <!-- Slides wrapper with overflow:hidden. -->
    <div class="pswp__scroll-wrap">

        <!-- Container that holds slides. 
            PhotoSwipe keeps only 3 of them in the DOM to save memory.
            Don't modify these 3 pswp__item elements, data is added later on. -->
        <div class="pswp__container">
            <div class="pswp__item"></div>
            <div class="pswp__item"></div>
            <div class="pswp__item"></div>
        </div>

        <!-- Default (PhotoSwipeUI_Default) interface on top of sliding area. Can be changed. -->
        <div class="pswp__ui pswp__ui--hidden">

            <div class="pswp__top-bar">

                <!--  Controls are self-explanatory. Order can be changed. -->

                <div class="pswp__counter"></div>

                <button class="pswp__button pswp__button--close" title="Close (Esc)"></button>

                <button class="pswp__button pswp__button--share" style="display:none" title="Share"></button>

                <button class="pswp__button pswp__button--fs" title="Toggle fullscreen"></button>

                <button class="pswp__button pswp__button--zoom" title="Zoom in/out"></button>

                <!-- Preloader demo http://codepen.io/dimsemenov/pen/yyBWoR -->
                <!-- element will get class pswp__preloader--active when preloader is running -->
                <div class="pswp__preloader">
                    <div class="pswp__preloader__icn">
                      <div class="pswp__preloader__cut">
                        <div class="pswp__preloader__donut"></div>
                      </div>
                    </div>
                </div>
            </div>

            <div class="pswp__share-modal pswp__share-modal--hidden pswp__single-tap">
                <div class="pswp__share-tooltip"></div> 
            </div>

            <button class="pswp__button pswp__button--arrow--left" title="Previous (arrow left)">
            </button>

            <button class="pswp__button pswp__button--arrow--right" title="Next (arrow right)">
            </button>

            <div class="pswp__caption">
                <div class="pswp__caption__center"></div>
            </div>

        </div>

    </div>

</div>
  </div>
</body>
</html>